<template>
	<view class="content">
		 
		<view class="village-box">
			<view class="village-item" v-for="(item,index) in villageList" :key="index">
				<view class="village-item-left">
					<view class="adress-box">
						<view class="shuxian"></view>
						<view class="adress">设备编号:  {{item.no}} <text class="info-text">({{item.status == 1 ? '已完成' : '未完成'}})</text></view>
					</view>
					<view class="time">
						<image src="/static/clock.png" mode=""></image>
						<span>{{item.create_time}} - {{item.close_time}}</span>
					</view>
				</view>
				<view class="village-item-right">
					<!-- <view class="huhao" v-if="item.status == 0" @tap="checkIMEI(item.equipment_id,item.task_id)">复核</view> -->
					<view class="huhao"  @tap="checkIMEI(item.equipment_id,item.id,item.task_id)">检查</view>
					<!-- <view class="huhao1" v-if="item.status == 1">通过</view> -->
				</view>
			</view>
		</view>
		<view class="nomodel" v-if="villageList.length==0">
			<u-empty  text="暂无内容"  mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	 
	export default { 
		data() {
			return {
				username: '',
				password: '',
				// array: ['安装工','检测工','维修工'],
				index: 0,
				userinfo:{},
				value:'',  //搜索关键词
				installList:[],  //安装列表
				dosearch:false,
				showAcount:false,
				page:1,
				villageList:[],
				active:0,
				token: '',
				checkId: '',
				typeName: ''
			};
		},
		onLoad(option) {
			this.typeName = option.name
			this.checkId = option.id
		},
		onShow() {
			uni.getStorage({
				key: 'token'
			}).then(da => {
				this.token = da[1].data;
				this.getInstallDetail()
			})
			 
		},
		 
		methods: {
			checkIMEI(equipment_id,id,task_id){
				console.log(task_id)
				uni.navigateTo({
					url:'IMEICheck2?equipment_id='+equipment_id+'&id=' + id + '&name=' + this.typeName + '&task_id=' + this.checkId
				})
			},
			// 获取安装数据
			getInstallDetail () {
				let that = this
				that.$request.request({
					url: '/staff/task_detail',
					method: 'POST',
					data: {
						token: that.token,
						task_id: that.checkId
					}
				}).then(res => {
					that.villageList = res.data.data
				})
			 },
			 back() {
				 uni.navigateBack({
					 delta: 1
				 });
			 }
		},
		
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #F5F5F5;
		// padding-bottom: 200rpx;
		// margin-bottom: 150rpx;
	}
	.content{
		padding-bottom: 140rpx;
	}
	.header{
		display: flex;
		justify-content:space-between;
		align-items: center;
		padding: 30rpx 30rpx;
		background-color: #fff;
		.header-left{
			display: flex;
			align-items: center;
			font-size: 32rpx;
			font-weight: 500;
			color: #333;
			image{
				width: 24rpx;
				height: 24rpx;
				margin-right: 20rpx;
			}
		}
		.header-right{
			display: flex;
			align-items: center;
			font-size: 24rpx;
			color: #333;
			image{
				width: 52rpx;
				height: 52rpx;
				margin-right: 10rpx;
			}
		}
	}
	.test-code:active{
		background: rgba(69, 82, 202, 0.4);
		color: #fff;
	}
	.plac-class{
		font-size: 32rpx;
		color: #999;
	}
	// nav
	.nav{
		width: 100%;
		height: 80rpx;
		background-color: #fff;
		.nav-box{
			display: flex;
			justify-content: space-between;
			align-items: center;
			width: 50%;
			margin: 0 auto;
			line-height: 76rpx;
			span{
				padding: 0 10rpx;
				font-size: 32rpx;
				color: #333;
				border-bottom: 4rpx solid transparent;
			}
			.current{
				color: #003690;
				border-bottom: 4rpx solid #003690;
			}
		}
	}
	// danger
	.village-item{
		position: relative;
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		width: 690rpx;
		padding:20rpx 30rpx;
		background-color: #fff;
		border-radius: 10rpx;
		margin: 20rpx auto 0;
		box-shadow:0px 3px 4px rgba(0,30,57,0.15);
		.flag{
			position: absolute;
			right: 0;
			top: 0;
			width: 100rpx;
			height: 100rpx;
		}
		.village-item-left{
			// display: flex;
			// align-items: center;
			.adress-box{
				display: flex;
				align-items: center;
				.shuxian{
					width: 8rpx;
					height: 28rpx;
					background-color: #003690;
					border-radius: 8rpx;
					margin-right: 20rpx;
				}
				.adress{
					font-size: 32rpx;
					color: #333;
				}
				.info-text{
					font-size: 24rpx;
					color: #003690;
				}
			}
			.time{
				display: flex;
				align-items: center;
				font-size: 24rpx;
				color: #777;
				image{
					width: 28rpx;
					height: 28rpx;
					margin-right: 10rpx;
				}
			}
			
		}
		.village-item-right{
			display: flex;
			align-items: center;
			.huhao{
				width: 94rpx;
				height: 46rpx;
				border: 2rpx solid #003690;
				border-radius: 16rpx;
				font-size: 28rpx;
				color: #003690;
				margin-right: 30rpx;
				text-align: center;
			}
			.huhao1{
				width: 94rpx;
				height: 46rpx;
				border: 2rpx solid #dddddd;
				border-radius: 16rpx;
				font-size: 32rpx;
				color: #dddddd;
				margin-right: 30rpx;
				text-align: center;
			}
		}
	}
</style>
